/**
 * 
 */
package co.fitstart.entity.course.round;

import com.demo2do.core.utils.Alias;

/**
 * @author downpour
 */
@Alias("roundStatus")
public enum RoundStatus {
    
    // 筹备中
    PREPARE("筹备中", "prepare"),
    
    // 上课中
    READY("上课中", "ready"),
    
    // 暂停
    HOLD("暂停", "hold"),
    
    // 已完成
    FINISH("已完成", "finish"),
    
    // 已逾期 -> 已失效
    EXPIRE("已失效", "expire"),
    
    // 已取消
    CANCEL("已取消", "cancel"),
    
    // 待激活
    ACTIVATE("待激活", "activate"),
    
    FOREVEREXPIRE("永久失效", "foreverexpire");
    
    private String description;
    
    private String alias;
    
    /**
     * 
     * @param alias
     * @param description
     */
    RoundStatus(String description, String alias) {
        this.alias = alias;
        this.description = description;
    }
    
    /**
     * 
     * @param alias
     * @return
     */
    public static RoundStatus aliasOf(String alias) {
        for (RoundStatus courseStatus : RoundStatus.values()) {
            if (courseStatus.getAlias().equalsIgnoreCase(alias)) {
                return courseStatus;
            }
        }
        
        return null;
    }
    
    /**
     * 
     * @return
     */
    public boolean isPrepare() {
        return this.equals(PREPARE);
    }
    
    /**
     * 
     * @return
     */
    public boolean isReady() {
        return this.equals(READY);
    }
    
    /**
     * 
     * @return
     */
    public boolean isHold() {
        return this.equals(HOLD);
    }
    
    /**
     * 
     * @return
     */
    public boolean isFinish() {
        return this.equals(FINISH);
    }
    
    /**
     * 
     * @return
     */
    public boolean isExpire() {
        return this.equals(EXPIRE);
    }
    
    
    public boolean isForeverexpire() {
        return this.equals(FOREVEREXPIRE);
    }
    
    /**
     * 
     * @return
     */
    public boolean isCancel() {
        return this.equals(CANCEL);
    }
    
    /**
     * 
     * @return
     */
    public boolean isActivate() {
        return this.equals(ACTIVATE);
    }
    
    /**
     * This course round is on scheduling or not
     * 
     * @return
     */
    public boolean isAvaliable() {
        return !this.equals(FINISH) || !this.equals(CANCEL);
    }

    /**
     * @return the description
     */
    public String getDescription() {
        return description;
    }

    /**
     * @return the alias
     */
    public String getAlias() {
        return alias;
    }
}
